<template>
	<view class="wrap">
		<view class="text-2xl u-text-center font-bold">用户注册</view>
		<u-form :model="form" ref="uForm" label-width="130">
			<u-form-item label="商户名称">
				<u-input v-model="form.name" />
			</u-form-item>
			<u-form-item label="联系电话">
				<u-input v-model="form.mobile" />
			</u-form-item>
			<u-form-item label="上传头像">
				<yh-upload @update="update" :path="form.avatar"></yh-upload>
			</u-form-item>

			<u-form-item label="邮箱">
				<u-input v-model="form.email" />
			</u-form-item>
			<u-form-item label="密码">
				<u-input v-model="form.password" />
			</u-form-item>
			<u-form-item label="确认密码">
				<u-input v-model="form.password_confirmation" type="password" />
			</u-form-item>
			<u-form-item label="验证码">
				<yh-captcha ref="captcha" v-model="form.captcha" />
			</u-form-item>
			<u-button type="success" @click="onSubmit">提交</u-button>
		</u-form>
	</view>
</template>

<script>
	const form={name:'小红泡泡',mobile:'15388398625',password:'admin888',email:'1123@qq.com',
	password_confirmation:'admin888'}
	export default {
		data() {
			return {
				form ,
				type: [],
			}
		},
		methods: {
			async onSubmit() {
				await this.api.post('register',this.form).then(_=>{
					const url='../../pages/login/index'
					uni.reLaunch({
						url
					})
				})
			},
			update(path) {
				this.form.preview = path
			}
		}
	}
</script>

<style>

</style>
